<template>
    <div ref="body" id="templateDiv">
        <Spin fix v-if="ExportLoading"></Spin>
        <Form :label-width="120" inline>
            <Form-item label="属地区划:">
                <area-linkage :areaCode.sync="queryParam.ssca0043"></area-linkage>
            </Form-item>
            <Form-item label="台卡年月:">
                <DatePicker type="month" v-model="queryParam.ssfa0002" placeholder="请选择台卡年月"
                            style="width: 200px"  :editable="false"></DatePicker>
            </Form-item>
            <Row class="button_row">
                <span style="float: left;">
                  <Button type="primary" icon="ios-cloud-download-outline" @click="exportE">
                    {{exportFileName}}导出
                  </Button>
                </span>
                <span style="float: right;">
                 <Button type="primary" @click="searchQueryNew">查询</Button>
                 <Button type="primary" class="button_item_left" @click="searchResetNew">重置</Button>
                     </span>
            </Row>
        </Form>
        <div class="table_div">
            <vxe-table border
                       resizable
                       row-id="id"
                       :row-key="true"
                       show-overflow="tooltip"
                       highlight-hover-row
                       align="center"
                       header-align="center"
                       ref="xTree"
                       :loading="Loading"
                       :data="tableData"
            >
                <vxe-table-column field="ssfa0002" title="台卡年月" align="center" width="100" :formatter="Time1"
                                  fixed="left"/>
                <vxe-table-column field="ssca0003" title="登记时间" align="center" width="100" :formatter="renderTime"
                                  fixed="left"/>
                <vxe-table-column field="ssca0014" title="证件号码" align="center" width="150" fixed="left"/>
                <vxe-table-column field="azcp0001" title="身份证号码" align="center" width="200" fixed="left"/>
                <vxe-table-column field="azcp0003" title="户主姓名" align="center" width="100" fixed="left"/>
                <vxe-table-column field="azcp0004" title="性别" align="center" width="100"/>
                <vxe-table-column field="azcp0007" title="民族" align="center" width="100"/>
                <vxe-table-column field="azdf0008" title="住址" align="center" width="200"/>
                <vxe-table-column field="azdf0009" title="邮编" align="center" width="100"/>
                <vxe-table-column field="azdf0011" title="电话" align="center" width="120"/>
                <vxe-table-column field="ssca0012" title="享受保障类别" align="center" width="120"
                                  v-if="queryParam.type=='100'"/>
                <vxe-table-column field="ssca0052" title="享受保障人数" align="center" width="120"/>
                <vxe-table-column field="xxxx0001" title="女性" align="center" width="100"/>
                <vxe-table-column field="xxxx0010" title="残疾人" align="center" width="100"/>
                <vxe-table-column field="xxxx0011" title="其中：重度残疾人" align="center" width="150"/>
                <vxe-table-column field="xxxx0020" title="老年人" align="center" width="100"/>
                <vxe-table-column field="xxxx0030" title="成年人" align="center" width="100"
                                  v-if="queryParam.type=='200'"/>
                <vxe-table-column field="xxxx0031" title="成年人：在职人员" align="center" width="150"/>
                <vxe-table-column field="xxxx0032" title="成年人：灵活就业" align="center" width="150"/>
                <vxe-table-column field="xxxx0033" title="成年人：登记失业" align="center" width="150"/>
                <vxe-table-column field="xxxx0034" title="成年人：无就业条件" align="center" width="150"/>
                <vxe-table-column field="xxxx0035" title="成年人：有劳动条件" align="center" width="150"
                                  v-if="queryParam.type=='200'"/>
                <vxe-table-column field="xxxx0036" title="成年人：无劳动条件" align="center" width="150"
                                  v-if="queryParam.type=='200'"/>
                <vxe-table-column field="xxxx0040" title="未成年人" align="center" width="100"/>
                <vxe-table-column field="xxxx0050" title="纳入扶贫建档立卡对象" align="center" width="180"
                                  v-if="queryParam.type=='200'"/>
                <vxe-table-column field="ssca0026" title="月保障、救济金额" align="center" width="150"/>
                <vxe-table-column field="ssca0049" title="享受低保家庭人口总收入/月" align="center" width="200"/>
                <vxe-table-column field="ssca0042" title="最低保障、救济标准" align="center" width="150"/>
                <vxe-table-column field="ssca0025" title="金额二" align="center" width="100"/>
                <vxe-table-column field="xxxx0091" title="金额三" align="center" width="100"/>
                <vxe-table-column field="ssca0009" title="开户银行" align="center" width="100"/>
                <vxe-table-column field="ssca0011" title="账号" align="center" width="200"/>
                <vxe-table-column field="xxxx0092" title="变动种类" align="center" width="100"/>
                <vxe-table-column field="xxxx0093" title="变动时间" align="center" width="100"/>
                <vxe-table-column field="xxxx0090" title="户主是否享受" align="center" width="120"/>
                <vxe-table-column field="xxxx0111" title="家庭成员姓名1" align="center" width="120"/>
                <vxe-table-column field="xxxx0112" title="身份证号码" align="center" width="200"/>
                <vxe-table-column field="xxxx0121" title="家庭成员姓名2" align="center" width="120"/>
                <vxe-table-column field="xxxx0122" title="身份证号码" align="center" width="200"/>
                <vxe-table-column field="xxxx0131" title="家庭成员姓名3" align="center" width="120"/>
                <vxe-table-column field="xxxx0132" title="身份证号码" align="center" width="200"/>
                <vxe-table-column field="xxxx0141" title="家庭成员姓名4" align="center" width="120"/>
                <vxe-table-column field="xxxx0142" title="身份证号码" align="center" width="200"/>
                <vxe-table-column field="xxxx0151" title="家庭成员姓名5" align="center" width="120"/>
                <vxe-table-column field="xxxx0152" title="身份证号码" align="center" width="200"/>
                <vxe-table-column field="xxxx0161" title="家庭成员姓名6" align="center" width="120"/>
                <vxe-table-column field="xxxx0162" title="身份证号码" align="center" width="200"/>
                <vxe-table-column field="xxxx0171" title="家庭成员姓名7" align="center" width="120"/>
                <vxe-table-column field="xxxx0172" title="身份证号码" align="center" width="200"/>
                <vxe-table-column field="xxxx0181" title="家庭成员姓名8" align="center" width="120"/>
                <vxe-table-column field="xxxx0182" title="身份证号码" align="center" width="200"/>
                <vxe-table-column field="xxxx0191" title="家庭成员姓名9" align="center" width="120"/>
                <vxe-table-column field="xxxx0192" title="身份证号码" align="center" width="100"/>
                <vxe-table-column field="xxxx0094" title="是否存在重复数据" align="center" width="150"/>
                <vxe-table-column field="xxxx0099" title="备注" align="center" width="200"/>
            </vxe-table>
            <Page :total="dataCount" :page-size="pageSize" show-total class="paging"
                  @on-change="handleTableChange" :current="pageNo"></Page>
        </div>


    </div>
</template>

<script>
    import {CommonMixin} from '@/views/common/js/CommonMixin'

    export default {
        name: "standingBook",
        mixins: [CommonMixin],
        data() {
            return {
                queryParam: {},
                type: "",
                Loading: false,
                url: {
                    list: "/api/ac/subsistence/standingBookServiceImpl/page",
                    exportExcel: "/api/ac/subsistence/standingBookServiceImpl/exportExcel",
                },
                exportFileName: "",
                ExportLoading: false
            }
        },
        methods: {
            edit(type, exportFileName) {
                this.type = type;
                this.exportFileName = exportFileName;
                this.queryParam.type = type;
                //this.loadData();
            },
            searchResetNew() {

                this.queryParam = {};
                this.queryParam.type = this.type;
                this.loadData(1);
            },
            exportE() {
                if (!this.queryParam.ssfa0002) {
                    this.$Message.error("请选择台卡年月！");
                } else if (!this.queryParam.ssca0043 || this.queryParam.ssca0043.search('000') != -1) {
                    this.$Message.error("台卡导出社区/村不能为空！");
                }
                else {
                    this.queryParam.ssfa0002 = this.DateFormat(this.queryParam.ssfa0002, 'YYYY-MM');
                    this.exportExcel();
                }
            },
            searchQueryNew() {
                if (!this.queryParam.ssfa0002) {
                    this.$Message.error("请选择台卡年月！");
                } else {
                    this.queryParam.ssfa0002 = this.DateFormat(this.queryParam.ssfa0002, 'YYYY-MM');
                    this.loadData();
                }
            },
            // cellStyle({row, rowIndex, column}) {
            //     if (column.property === 'ssca0014') {
            //         return {
            //             backgroundColor: '#187',
            //             color: '#ffffff'
            //         }
            //     }
            //     if (row.age === 24) {
            //         return {
            //             backgroundColor: '#2db7f5',
            //             color: '#000'
            //         }
            //     }
            //     if ([2, 3, 5].includes(rowIndex)) {
            //         return {
            //             backgroundColor: 'red',
            //             color: '#ffffff'
            //         }
            //     }
            // }
        },
    }
</script>

<style scoped>

</style>